# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=pytest-ordering
pkgname=python-${_pkg}
pkgver=0.6
pkgrel=6
pkgdesc="pytest plugin to run your tests in a specific order"
arch=(any)
url="https://github.com/ftobia/pytest-ordering"
license=(MIT)
depends=(python-pytest)
makedepends=(python-setuptools)
#PyPi does not have tests nor LICENSE
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
        ${pkgname}-pre-marks.patch::${url}/commit/6a544f9b614a0701e24edac8b0a4c2a80159120e.patch
        ${pkgname}-register-marks.patch::${url}/commit/6de05faa7d399a3f0f99b33b75747d39adb1f535.patch)
sha256sums=('c1149011a3bec662d4dd92427197bd5d02546f380b3568eb6217efb743614309'
            '2d629caff7530adc0359bb4881e32c65f7bc5ff117f3f2ad81c1318b589eb9bd'
            'd433345dbb6e399d3a646fc2a25718afd53dc230496aaa60def843f8ebac7fde')

prepare() {
  cd ${_pkg}-${pkgver}
  patch -p1 -i ../${pkgname}-pre-marks.patch
  patch -p1 -i ../${pkgname}-register-marks.patch
}

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

# All ordering tests are failing
# https://github.com/ftobia/pytest-ordering/issues/62
#check() {
#  cd ${_pkg}-${pkgver}
#  PYTHONPATH="${PWD}/build/lib/" pytest tests
#}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
